(()=>{var Le=Object.defineProperty,Ue=Object.defineProperties;var $e=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable;var q=(t,e,r)=>e in t?Le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p=(t,e)=>{for(var r in e||(e={}))Ce.call(e,r)&&q(t,r,e[r]);if(B)for(var r of B(e))Pe.call(e,r)&&q(t,r,e[r]);return t},Y=(t,e)=>Ue(t,$e(e));var c=(t,e,r)=>new Promise((n,i)=>{var o=s=>{try{a(r.next(s))}catch(h){i(h)}},l=s=>{try{a(r.throw(s))}catch(h){i(h)}},a=s=>s.done?n(s.value):Promise.resolve(s.value).then(o,l);a((r=r.apply(t,e)).next())});var x=class{constructor(e={}){e=Object.assign({resolveTimeout:null,resolveValue:!0,rejectTimeout:null,rejectValue:!1},e),this._promise=new Promise((l,a)=>{this.resolve=l,this.reject=a}),this.then=this._promise.then.bind(this._promise),this.catch=this._promise.catch.bind(this._promise),this.finally=this._promise.finally.bind(this._promise),this[Symbol.toStringTag]="Promise";let{resolveTimeout:r,resolveValue:n,rejectTimeout:i,rejectValue:o}=e;r&&setTimeout(()=>this.resolve(n),r),i&&setTimeout(()=>this.reject(o),i)}};var I="layer",z="quiz";function Q(t){return t.reduce(function(e,r){return e[r]=new x,e},{})}function J(t){return function(e,r){return c(this,null,function*(){if(!t[e])throw new Error(`unknown "${e}" app!`);r(yield t[e])})}}var D="__DF_DEBUG_MODE__",G="true",g=window.sessionStorage;function Z(){g.setItem(D,G)}function W(){g.removeItem(D)}function L(){return g.getItem(D)===G}function b(t){return g.getItem(t)||window[t]}function S(t,e){g.setItem(t,e)}function f(...t){L()&&console.log("[doofinder]",...t)}var Te=10,Re=500;function X(t,e={}){let r=document.querySelector(t);return r?Promise.resolve(r):new Promise((n,i)=>{let o=0,l=null,a=e.interval||Re,s=e.times||Te;l=setInterval(function(){o++r.offsetWidth>0&&r.offsetHeight>0)}updateQuery(e=""){return c(this,null,function*(){let r=yield this.getElement();r instanceof HTMLInputElement&&(r.value=e)})}focus(){return c(this,null,function*(){let e=yield this.getElement();e instanceof HTMLInputElement&&e.focus()})}setCaptureLength(e){this._minCaptureLength=e||ee}getElement(){return c(this,null,function*(){if(!(!this._enabled||!this._elementSelector)){if(!this._element)try{this._element=yield X(this._elementSelector)}catch(e){this._element=void 0}return this._element}})}get enabled(){return this._enabled}set enabled(e){if(this._enabled!==!!e){this._enabled=!!e;let r=document[`${this._enabled?"add":"remove"}EventListener`];this._events.forEach(n=>r(...n))}}get captureSubmit(){return this._handleSubmit}set captureSubmit(e){this._handleSubmit=!!e}get redirection(){return this._redirection}set redirection(e){this._redirection=e}setEventBus(e){this._eventBus=e}flushMessages(){var e;if(this._eventsQueue=[...new Map(this._eventsQueue).entries()],this._eventsQueue.length>0){let r=this._eventsQueue.shift();for(;r&&r.length===2;)f("trigger:emit",r),(e=this._eventBus)==null||e.emit(...r),r=this._eventsQueue.shift()}else document.activeElement===this._element&&this.notify(te,this.getPayload())}destroy(){this._events.forEach(e=>window.removeEventListener(...e))}shouldHandle(e){let r=this.getElementFromEvent(e);return r?(this._element=r,!0):!1}getPayload(e){let r={source:this._element,originalEvent:e};if(this._element instanceof HTMLInputElement){let n=this._element.value.trim();(n.length>=this._minCaptureLength||(e==null?void 0:e.type)==="keydown")&&(r.query=n)}return r}getElementFromEvent(e){if(!e.target||e.target===document||e.target===window)return;let r=e.type==="submit"?"querySelector":"closest",n=e.target[r](this._elementSelector);if(n&&!n.closest("[dfd-hook]"))return n}handleClick(e){this.shouldHandle(e)&&(e.preventDefault(),e.stopImmediatePropagation(),this.notify(te,this.getPayload(e)))}handleFocus(e){this.shouldHandle(e)&&(e.stopImmediatePropagation(),this.notify(ke,this.getPayload(e)))}handleInput(e){this.shouldHandle(e)&&this.notify(je,this.getPayload(e))}handleSubmit(e){this._handleSubmit&&this.shouldHandle(e)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.notify(re,this.getPayload(e)))}handleKeypress(e){e.key==="Enter"&&this.shouldHandle(e)&&(!!this._redirection||this._handleSubmit)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this._redirection?window.location=this._redirection.url:e.type==="keydown"&&this.notify(re,this.getPayload(e)))}notify(e,r){this._eventBus?this._eventBus.emit(e,r):this._eventsQueue.push([e,r]),f("[trigger]",this._eventBus?"[emit]":"[queue]",e,r)}};function ne(t){let e=document.cookie.match(new RegExp("(?:^|; )"+t.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));if(e)return decodeURIComponent(e[1])}var $=Object.freeze({language(t){let e=(t==null?void 0:t.replaceAll("_","-").trim().split("-"))||[];function r(n){return n?`-${n.toUpperCase()}`:""}if(e.length<3){let[n,i]=e;return`${n==null?void 0:n.toLowerCase()}${r(i)}`}else{let[n,i,o]=e;return`${n==null?void 0:n.toLowerCase()}-${i.toUpperCase()}${r(o)}`}},currency(t){return t==null?void 0:t.trim().toUpperCase()}});function C(){return b("__DF_CDN_PREFIX__")}function ie(t,e=!1){let r=b("__DF_LAYER_SERVER__")||`https://${t.toLowerCase()}-layer.doofinder.com`;return e?r.replace(/^http/,"ws"):r}var oe=1;function d(t,e,r){r!=null&&(typeof r!="string"||!!r.trim())&&t.push(`${e}=${r}`)}function Ae(t,e){var h;let{installationId:r,zone:n,language:i,currency:o}=t,a=`${ie(n)}/api/${oe}/installation/${r}`,s=[];return d(s,"source_url",encodeURIComponent(window.location.href)),d(s,"session_id",Doofinder.Session.getSessionId()),d(s,"session_alive",Doofinder.Session.isLive("layer","quiz")),d(s,"last_used_apps",Doofinder.Session.getLastUsedApps()),d(s,"user_id",Doofinder.Session.getUserId()),d(s,"language",$.language(i||document.documentElement.getAttribute("lang"))||""),d(s,"currency",$.currency(o)||""),d(s,"ga_client_id",(h=ne("_ga"))==null?void 0:h.substring(6)),d(s,"vsn","1.5.9"),d(s,"layer_type",e),d(s,"zone",n),`${a}?${s.join("&")}`}function Oe(t){let e=C()||t.cdn_prefix;e=="https://cdn.doofinder.com/livelayer"&&(e+="/1");let r=t.vsn;return se(t,i=>({url:`${e}${i}?vsn=${r}`}))}function Ne(t){if(!t.cdn_fallback_prefix)return Oe(t);let e=t.vsn,r=C()||t.cdn_prefix+"/"+e;return se(t,i=>{let o=`${r}${i}`;o=r.includes("staging")?`${o}?vsn=${e}`:o;let l=`${t.cdn_fallback_prefix}${i}`;return{url:o,fallbackUrl:l}})}function se(t,e){return L()&&(t.js=t.js.map(r=>r.replace(/\.min\.js/i,".js"))),t.css=t.css.map(e),t.js=t.js.map(e),t}function le(t,e){return new Promise(function(r,n){fetch(Ae(t,e),{redirect:"follow"}).then(function(i){i.ok?i.json().then(function(o){r(Ne(o))}):n(`HTTP ${i.status} error response from server`)}).catch(i=>n(i))})}function P(t){return c(this,null,function*(){let{url:e,fallbackUrl:r}=t;if(!document.querySelector(`script[src="${e}"]`)){let n=document.createElement("script");n.src=e,n.async=1,r&&(n.onerror=()=>P({url:r})),document.head.appendChild(n)}})}function T(t){return c(this,null,function*(){let{url:e,fallbackUrl:r}=t;if(!document.querySelector(`link[rel="stylesheet"][href="${e}"]`)){let n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",e),r&&(n.onerror=()=>T({url:r})),document.head.appendChild(n)}})}function R(t){return c(this,null,function*(){let e=document.createElement("style");e.appendChild(document.createTextNode((t||"").trim())),document.head.appendChild(e)})}function ae(t,e){let r=e.options,n=t.hashid||r.hashid,{autoload:i,insertion_point:o,is_checkout:l}=e,a="urlHash"in t?!!t.urlHash:!!r.url_hash,s=e.layer_type;return delete t.urlHash,delete r.url_hash,Y(p(p({},t),r),{autoload:i,urlHash:a,hashid:n,layerType:s,insertion_point:o,is_checkout:l})}var ue=new Promise((t,e)=>{document.readyState!="loading"?t():document.addEventListener("DOMContentLoaded",()=>{t()})});function ce(t){return S("__DF_CDN_PREFIX__",t)}function de(t){return S("__DF_LAYER_SERVER__",t)}function me(){try{decodeURIComponent(location.href)}catch(t){throw new Error("invalid UTF-8 on url-encoded query params")}}var k="df-cookies-allowed",j=window.localStorage;function A(){j.setItem(k,"true")}function fe(){j.removeItem(k)}function he(){return JSON.parse(j.getItem(k)||"false")}var E,Ve=new Uint8Array(16);function O(){if(!E&&(E=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!E))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return E(Ve)}var u=[];for(let t=0;t<256;++t)u.push((t+256).toString(16).slice(1));function pe(t,e=0){return u[t[e+0]]+u[t[e+1]]+u[t[e+2]]+u[t[e+3]]+"-"+u[t[e+4]]+u[t[e+5]]+"-"+u[t[e+6]]+u[t[e+7]]+"-"+u[t[e+8]]+u[t[e+9]]+"-"+u[t[e+10]]+u[t[e+11]]+u[t[e+12]]+u[t[e+13]]+u[t[e+14]]+u[t[e+15]]}var He=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),N={randomUUID:He};function Me(t,e,r){if(N.randomUUID&&!e&&!t)return N.randomUUID();t=t||{};let n=t.random||(t.rng||O)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let i=0;i<16;++i)e[r+i]=n[i];return e}return pe(n)}var _=Me;var ge={canPushState(){return typeof history.pushState!="undefined"},dropLocal(t,e,r){return t.removeItem(this.localKey(e,r))},updateLocal(t,e,r,n,i){let o=this.getLocal(t,e,r),l=this.localKey(e,r),a=o===null?n:i(o);return t.setItem(l,JSON.stringify(a)),a},getLocal(t,e,r){return JSON.parse(t.getItem(this.localKey(e,r)))},updateCurrentState(t){!this.canPushState()||history.replaceState(t(history.state||{}),"",window.location.href)},pushState(t,e,r){if(this.canPushState()){if(r!==window.location.href){if(e.type=="redirect"&&e.scroll){let i=history.state||{};i.scroll=e.scroll,history.replaceState(i,"",window.location.href)}delete e.scroll,history[t+"State"](e,"",r||null);let n=this.getHashTargetEl(window.location.hash);n?n.scrollIntoView():e.type==="redirect"&&window.scroll(0,0)}}else this.redirect(r)},setCookie(t,e){document.cookie=`${t}=${e}`},getCookie(t){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${t}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(t,e){e&&ge.setCookie("__phoenix_flash__",e+"; max-age=60000; path=/"),window.location=t},localKey(t,e){return`${t}-${e}`},getHashTargetEl(t){let e=t.toString().substring(1);if(e!=="")return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},V=ge;var _e=12*60*60*1e3,ye="df",be="random-userid",H="session",Se="apps",Ee="tab-id",ve=window.localStorage,we=window.sessionStorage;function v(t,e=ve){return V.getLocal(e,ye,t)}function y(t,e,r=ve){return he()?V.updateLocal(r,ye,t,e,()=>e):null}function Ke(){return{id:_().replaceAll("-",""),expiry:new Date().getTime()+_e,live:[]}}function M(){let t=v(H);return(!t||Fe(t))&&(t=Ke()),y(H,t)}function Fe({expiry:t}){return te.live.includes(n))}};function Be(){return{"content-type":"application/json"}}function w(r){return c(this,arguments,function*(t,e={}){return(yield fetch(t,p({method:"GET",cache:"no-cache",mode:"cors",headers:Be()},e))).json()})}var K=class{constructor(e){this.zone=e}add(a,s,h){return c(this,arguments,function*(e,r,{id:n,title:i,price:o},l=1){let Ie=`${this.url(e)}/cart/${m.getSessionId()||""}`,De=JSON.stringify({amount:l,id:n,title:i,price:o,index:r});return w(Ie,{method:"PUT",body:De})})}remove(e,r,n,i=1){return c(this,null,function*(){let o=`${this.url(e)}/cart/${m.getSessionId()||""}`,l=JSON.stringify({amount:i,id:n,index:r});return w(o,{method:"PATCH",body:l})})}clear(e){return c(this,null,function*(){let r=`${this.url(e)}/cart/${m.getSessionId()||""}`;return w(r,{method:"DELETE"})})}checkout(e){return c(this,null,function*(){let r=JSON.stringify({session_id:m.getSessionId(),user_id:m.getUserId(),sources:m.getLastUsedApps().split(",")});return w(`${this.url(e)}/checkout`,{method:"PUT",body:r})})}url(e){return`https://${this.zone}-search.doofinder.com/6/${e}/stats`}};var qe={get Session(){return m},buildCart(t){return new K(t)}},xe=qe;var F=Q([I,z]),Ye=J(F);document.addEventListener("doofinder.register",t=>{let{name:e,entrypoint:r}=t.detail;F[e].resolve(r)});var ze={vsn:"1.5.9",getRegistry(t){return F[t]},load(t,e){me(),A(),Qe(t,e,"search")},enableDebug:Z,disableDebug:W,setLayerServerUrl:de,setCDNServerUrl:ce,enableCookies:A,disableCookies:fe};function Qe(t,e,r){le(t,r).then(n=>{var o;n.css.forEach(T),n.custom_css.forEach(R);let i=(o=n.custom_properties)==null?void 0:o.join(` `);t=ae(t,n),t.trigger=Je(t),Ye(I,function(l){ue.then(()=>{let a=l.create(t);R(`#${a.mount.id} { ${i||""} }`),r=="category_pages"&&a.open(t),typeof e=="function"&&e(a)})}),n.js.forEach(P)}).catch(n=>{console.error("[Doofinder] error retrieving resources:",n)})}function Je(t){let{autoload:e,trigger:r}=t,n=new U(r);return n.enabled=!e||e.trigger,n}Object.defineProperty(window,"Doofinder",{value:xe,writable:!1});Object.defineProperty(window,"doofinderLoader",{value:ze,writable:!1});})();